package com.yumingjiang.acs.controller;

import com.yumingjiang.acs.vo.UserVO;
import com.yumingjiang.tool.enums.ErrorCode;
import com.yumingjiang.api.model.permission.PermissionModel;
import com.yumingjiang.api.model.role.RoleModel;
import com.yumingjiang.tool.result.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: John
 * @version: UserController.java, v1.0 2024年12月10日 20:41
 */
@RestController
@RequestMapping("/asc/user")
public class UserController {

    @GetMapping("/queryByUid")
    public Result<UserVO> queryUserInfo(String userId){
        UserVO userVO = new UserVO();
        userVO.setUid("uid001");
        userVO.setName("张三");
        userVO.setUserCode("U0001");
        userVO.setSex("男");
        userVO.setWorkId("wid001");

        List<PermissionModel> permissionModels = new ArrayList<>();
        PermissionModel permissionModel = new PermissionModel();
        permissionModel.setPid("pid001");
        permissionModel.setPermissionCode("Pid0001");
        permissionModel.setPermissionName("查询权限");
        permissionModels.add(permissionModel);
        userVO.setPermissionModels(permissionModels);

        List<RoleModel> roleModels = new ArrayList<>();
        RoleModel roleModel = new RoleModel();
        roleModel.setRoleCode("Rid0001");
        roleModel.setRoleName("管理员");
        roleModel.setRid("rid001");
        roleModels.add(roleModel);
        userVO.setRoleModels(roleModels);

        Result<UserVO> userVOResult = new Result<>();
        userVOResult.setSuccess(true);
        userVOResult.setData(userVO);
        userVOResult.setCode(ErrorCode.SUCCESS.getCode());
        userVOResult.setMessage(ErrorCode.SUCCESS.getDesc());
        return userVOResult;
    }
}